<!doctype html>
<html manifest="manifest.json"> 
<head>
<meta charset="utf-8" />
<title>beatWife</title>
		<link href="images/buttons.css" rel="stylesheet" />
<style>
	* {
		margin: 0;
		padding: 0;
	}

	body {
		text-align: center;padding:20px 10px 10px;
	}
	del{text-decoration:line-through;}

	#avatarSample{-webkit-box-reflect:below 3px
    -webkit-gradient(linear, left top, left bottom, from(transparent),
    color-stop(0.55, transparent), to(white));margin-bottom:50px;position:relative;}
	#beatCount{opacity:.7;background:#000;color:#FFF;-webkit-border-radius:2px; -webkit-transform: rotate(45deg);position:absolute;right:-65px;top:15px;width:100%;text-align:center;font-size:14px;color:#FFF;line-height:1.2;padding:0 3px;font-family:Tahoma,Verdana,Arial;}
	#updateStatus{display:none;-webbkit-border-radius:5px;padding:10px;font-size:13px;color:#FFF;position:absolute;left:5px;top:5px;right:5px;bottom:5px;background:rgba(0,0,0,.6);z-index:99999;}
	#updateStatus .button{position:absolute;bottom:5px;left:50%;margin-left:-50px;}
</style>
</head>
<body>
<div id="updateStatus">
	Thank Miss LinZhiLing for making <del>love</del> voice<br />
	Keep clicking if you are alone & lonely<br /><br />
	感谢声优：林志玲小姐<br />
	(如果你单身一人，寂寞难耐，<br />请保持0.1秒的频率点击)
	<a class="button pink serif round glass" data-icon="♛" href="#">OK</a>
</div>
<!--<div id="groanDefault">wifeRocks <span id="beatCount"><img src="images/ajax_loading.gif" /></span> Times</div>-->
<div id="groan"></div>
<div id="beatCount"></div>
<img id="avatarSample" src="images/icon_48.png" alt="avatar" title="bite or beat me?" class="l" /><br />
<button type="button" class="button green">beatMe!</button>
<script src="images/jQuery.js"></script>
<script>
	var timer_snd;
	var snd = new Audio("lzl.mp3");
		snd.loop;
$('#avatarSample').attr('src', localStorage.avatarURL);
$('#beatCount').text(localStorage.beatCount);
$('button').click(function() {
	if (localStorage.mode == "beat") {
		chrome.extension.getBackgroundPage().beat();
	} else {
		chrome.extension.getBackgroundPage().ooxx();
	}
	$('#avatarSample').stop().css({'opacity':.5,'top':-5,'left':3}).animate({opacity:1,top:0,left:0}, {duration:200 });
	$('#beatCount').text(localStorage.beatCount);
	snd.play();
	window.clearTimeout(timer_snd);
	timer_snd = window.setTimeout(function() {
		snd.pause();
	}, 100);
});
$('#updateStatus .button').click(function(){
	$('#updateStatus').slideUp('slow');
		if (JSON.parse(localStorage.isAgreed) < localStorage.version) {
		localStorage.isAgreed = localStorage.version;
	}
});
if (JSON.parse(localStorage.isAgreed) < localStorage.version){
	$('#updateStatus').fadeIn();
}
//konami code
$(function() {
	var k = []; //建立一个空的数组
	$(document).keydown(function(e) {
		k.push(e.keyCode); //把每一次按下的键码加入到数组k当中
		if (k.toString().indexOf('38,38,40,40,37,39,37,39,66,65') >= 0) { //判断如果数组k中可以查找到指定的字符串 即返回值大于等于0
			if (confirm("Are you 18+?")) {
				localStorage.mode = "ooxx"
				if (confirm("wanna hide the number?")) {
					localStorage.beatCountEnabled = 0;
					chrome.browserAction.setBadgeText({text:""});
				}else{
					localStorage.beatCountEnabled = 1;
					chrome.browserAction.setBadgeText({text:""});
				}
			} else {
				localStorage.mode = "beat"
			}
			k = [];//清空数组k 以便再次触发事件
		}
	});

});
// rc


// dev
/*	$(window).unload(function() {
 alert('msgFromWife:"へようこそ私たちの次の 嗷～');
 chrome.browserAction.setBadgeText({text:""});
 });

 function load(type) {
 var stamp = +new Date();
 current_request = $.ajax({
 type: "GET",
 url: url,
 data: 'stamp=' + stamp + '&type=' + type + '&size=' + size,
 beforeSend: function(request) {
 $(".loading").removeClass('stop').show('slow').html('loading...no.' + count);
 },
 error: function(xhr, ajaxOptions, thrownError) {
 $(".loading").html('Shit happens: <br />' + xhr.status + '<br />' + thrownError);
 },
 success: function(msg) {
 $(".loading").fadeOut();
 if (count < limit) {
 count++;
 switch (type) {
 case 'js':
 load('css')
 break
 case 'css':
 load('img')
 break
 case 'img':
 load('js')
 break
 default:
 alert('damn switch')
 }
 } else {
 $("#submit").attr("disabled", "disabled");
 $("#abort").attr("disabled", "disabled");
 $('<li>Done!</li>').appendTo('.list').fadeIn('slow');
 return false;
 }
 }
 });
 }
 load('js');*/
</script>

</body>
</html>